spb/company-atlas
Public
Python 66.3%
TypeScript 22.7%
JavaScript 8.6%
HTML 1.4%
CSS 0.7%
1import type { Metadata } from 'next';2import Link from 'next/link';3import { notFound } from 'next/navigation';4import { DiffViewer } from '@/components/events/diff-viewer';5import { Container, Note } from '@/components/ui/section';6import { api, ApiError } from '@/lib/api';7import { fmtDateTime, fmtInt } from '@/lib/format';8import { routes } from '@/lib/site';910export const revalidate = 3600;11export const metadata: Metadata = { title: 'Snapshot diff', robots: { index: false } };1213export default async function SnapshotDiffPage({ params }: { params: Promise<{ id: string; other: string }> }) {14 const { id, other } = await params;15 let d;16 try {17 d = await api.snapshotDiff(id, other);18 } catch (e) {19 if (e instanceof ApiError && e.notFound) notFound();20 throw e;21 }22 return (23 <Container>24 <div className="pb-4 pt-6 md:pt-10">25 <p className="eyebrow">Historical page viewer · semantic diff</p>26 <h1 className="display mt-2 text-[24px] md:text-[32px]">27 v{d.before.version_no} → v{d.after.version_no}28 </h1>29 <div className="mt-3 grid gap-3 sm:grid-cols-2">30 {[d.before, d.after].map((s, i) => (31 <div key={s.id} className="border border-rule p-3 text-sm">32 <p className="eyebrow">{i === 0 ? 'Before' : 'After'}</p>33 <p className="mt-1 font-medium text-ink">{s.title ?? '—'}</p>34 <p className="tnum text-xs text-ink-3">35 {fmtDateTime(s.fetched_at)} · {fmtInt(s.block_count)} blocks · {fmtInt(s.text_length)} chars36 </p>37 <Link href={routes.snapshot(s.id)} className="link text-xs">38 Open version →39 </Link>40 </div>41 ))}42 </div>43 <p className="mt-2 text-xs text-ink-3">44 <Link href={routes.sensor(d.after.sensor_id)} className="link">45 Sensor46 </Link>47 </p>48 </div>49 <DiffViewer diff={d.diff} significance={null} />50 <Note className="mt-6">Computed on demand from the two stored snapshots. Block identities are stable across versions so moved content is not reported as removed + added.</Note>51 </Container>52 );53}54